//
//  MPPersonalDetailModel.m
//  MPOtherHomeDemo
//
//  Created by YC on 2018/9/12.
//  Copyright © 2018年 yc. All rights reserved.
//

#import "MPPersonalDetailModel.h"
#import <MJExtension/MJExtension.h>

@implementation WritingRespDTOListItem

+ (NSDictionary *)mj_replacedKeyFromPropertyName {
    return @{@"ID":@"id"};
}

- (float)cellHeight {
    
    // 顶部与日期的空白
    float space1 = 10;
    
    // 日期高度,默认为0，在tableview的代理方法里添加该高度
    
    // 日期与标题的空白
    float space2 = 15;
    
    // 标题高度
    CGSize titleSize = [self.title boundingRectWithSize:CGSizeMake(kScreenWidth-60, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size;
    float titleHeight = titleSize.height;
    
    // 标题与图片的间隙
    float space3 = 3;

    // 图片高度
    float imageHeight = 0;
    switch (self.images.count) {
        case 1:
            imageHeight = kScreenWidth/2;
            break;
        case 2:
            imageHeight = (kScreenWidth-60)/2;
            break;
        case 3:
            imageHeight = (kScreenWidth-40-3-3-10)/3;
            break;
            
        default:
            break;
    }
    
    // 图片与点赞的间隙
    float space4 = 5;
    
    // 点赞、评论等的高度
    float bottomHeight = 40;
    
    // 底部间隙
    float space5 = 5;
    
    return space1 +space2 + titleHeight + space3 + imageHeight + space4 + bottomHeight + space5;
}

@end



@implementation MPPersonalDetailModel

+ (NSDictionary *)mj_objectClassInArray {
    return @{@"writingRespDTOList":[WritingRespDTOListItem class]};
}

@end


